<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>lele | 开启博客之旅</title>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="/dist/css/AdminLTE.min.css">
  <!-- iCheck -->
  <link rel="stylesheet" href="/plugins/iCheck/square/blue.css">
</head>
<body class="hold-transition register-page">
<div class="register-box">
  <div class="register-logo">
    <b>lele</b>博客
  </div>

  <div class="register-box-body">
    <p class="login-box-msg">注册一个新账号</p>

    <form action="/add" method="post" id="register">
      <div class="form-group has-feedback">
        <input type="text" class="form-control" name="username" placeholder="姓名">
        <span class="glyphicon glyphicon-user form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="email" class="form-control" name="email" placeholder="Email">
        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="text" class="form-control" name="phone" placeholder="手机号">
        <span class="glyphicon  glyphicon-phone form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="password" class="form-control" name="password" placeholder="密码">
        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="password" class="form-control" name="confirmPassword" placeholder="确认密码">
        <span class="glyphicon glyphicon-log-in form-control-feedback"></span>
      </div>
      <div class="row">
        <div class="col-xs-8">
          <div class="checkbox icheck">
            <!-- <label>
              <input type="checkbox"> I agree to the <a href="#">terms</a>
            </label> -->
            <a href="/login" class="text-center">去登陆</a>
          </div>
          
        </div>
     
        <!-- /.col -->
        <div class="col-xs-4">
          <button type="submit" class="btn btn-primary btn-block btn-flat" id="validateBtn">注册</button>
        </div>
        <!-- /.col -->
      </div>
    </form>

    <!-- <div class="social-auth-links text-center">
      <p>- OR -</p>
      <a href="#" class="btn btn-block btn-social btn-facebook btn-flat"><i class="fa fa-facebook"></i> Sign up using
        Facebook</a>
      <a href="#" class="btn btn-block btn-social btn-google btn-flat"><i class="fa fa-google-plus"></i> Sign up using
        Google+</a>
    </div> -->

   
  </div>
  <!-- /.form-box -->
</div>
<!-- /.register-box -->

<!-- jQuery 2.2.3 -->

<script src="/bootstrap/js/bootstrapValidator.js"></script>

<script>
  $(function () {
    $('input').iCheck({
      checkboxClass: 'icheckbox_square-blue',
      radioClass: 'iradio_square-blue',
      increaseArea: '20%' // optional
    });
  });

  $(document).ready(function() {
    $('#register').bootstrapValidator({
      message: 'This value is not valid',
         feedbackIcons: {
             valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
         },
        
      fields: {
        username: {
                validators: {  
                      notEmpty: {                        
                        message: '姓名不能为空'                     
                      },
                      different: {
                            field: 'password',
                            message: '姓名和密码不能相同'
                      },                 
                    }             
                },
        email: {
          validators: {  
            emailAddress: {
                      message: '请输入合法的邮件地址'
                    }              
              }             
          },
         password: {
            validators: {  
                  notEmpty: {                        
                    message: '密码不能为空'                     
                  },
                  different: {
                         field: 'username',
                         message: '密码和姓名不能相同'
                     },
                     regexp: {
                            regexp: /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$/,
                            message: '必须包含大小写字母和数字的组合，不能使用特殊字符，长度在8-10之间'
                        }

                }             
            },
          confirmPassword: {
            validators: {  
                  notEmpty: {                        
                    message: '请确认密码'                     
                  },
                  identical: {
                         field: 'password',
                         message: '两次的输入不一致'
                     },
                  different: {
                         field: 'username',
                         message: '密码和姓名不能相同'
                     }
                }             
            },
        phone: {
            validators: {  
                  notEmpty: {                        
                    message: '手机号不能为空'                     
                  },
                  regexp: {
                            regexp: /^1[3456789]\d{9}$/,
                            message: '手机号格式错误'
                        }                 
                }             
            }
      }
    })
     
  })
</script>
</body>
</html>
